<template>
    <div class="parcelDetail">
        <Card>
            <mail-info
            :mailInfoDeatil="mailInfoDeatil"
            ></mail-info>
        </Card>
        <Card>
            <h2 class="file_title mb10" style="font-size:16px;color: #515a6e">文件信息</h2>
            <file-info
            :fileInfoList="fileInfoList"
            :total="total"
            @turnPage="turnPage"
            @turnPageSize="turnPageSize"
            :isEdit="isEdit"
            >
            </file-info>
        </Card>
    </div>
</template>
<script>
    import {
        getmailDetail
    } from "_p/afs-apply/api/mail-manage/orderMailList.js";
    import MailInfo from "../../mail-manage/common/mail-info.vue"
    import FileInfo from "../../mail-manage/common/file-info.vue"
    export default {
        name:"parcelDetail",
        data(){
            return {
                isEdit:false,
                fileInfoList:[],
                mailInfoDeatil:{},
                formPage:"parcelDetail",
                postNo:"",
                pageSize:10,
                pageIndex:1,
                total:0,
            }
        },
        created(){

        },
        mounted(){
            if (this.afs.getPageParams(this)) {
                console.log(this.afs.getPageParams(this),"this.afs.getPageParams(this)")
                this.postNo=this.afs.getPageParams(this).postno;
                // this.postNo="263877276285";
                this.initmailDetail();
            }
        },
        methods:{
            initmailDetail(){
                let param={
                    pageIndex:this.pageIndex,
                    pageSize:this.pageSize,
                    postNo:this.postNo,
                }
                getmailDetail(param).then(res=>{
                    if(res.code="0000"){
                        this.total=res.data.dcPostDetail.recordsTotal;
                        // 邮寄信息
                        let tempObj={
                            postNo:res.data.dcPost[0].postNo,
                            pUserId:res.data.dcPost[0].pUserId,
                            pDate:res.data.dcPost[0].pDate,
                            memo:res.data.dcPost[0].memo,
                        }
                        this.mailInfoDeatil=tempObj;
                        // 文件信息
                        let tempArr=[];
                        res.data.dcPostDetail.records.forEach(item => {
                            let obj={
                                dcpostfileCamainNo:item.camainNo,//申请编号
                                caafterCard:item.caafterCard,//证件号码
                                caafterBorrowername:item.caafterBorrowername,//客户姓名
                                statusfilename:item.refData.statusfilename,//归档状态
                                md5List:item.md5List,
                            }
                            if(item.names){
                                let filetypes=item.names.split(',');
                                obj.filetypes=filetypes;
                            }
                            tempArr.push(obj);
                        })
                        this.fileInfoList=tempArr;

                    }
                })
            },
            turnPageSize(pageData){
                this.pageSize=pageData.pageSize;
                this.initmailDetail()
            },
            turnPage(pageData){
                this.pageIndex=pageData.pageNumber;
                this.initmailDetail()
            }
        },
        components:{
            MailInfo,
            FileInfo
        },

    }
</script>
<style scoped>
</style>
